-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluator Rewards #47
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- mainnet_token_max_supply - funding_destination_account
…ends the funding immediately. Thought out values added to rewards function on FinishedProject instantiation based on the knowledge hub example.
… of the protocol pending
…t not passing yet due to tiny decimal inconsistency
…g operations inside on_idle
…ew implementation pending. Logic for reward calculation is now correct. But the extrinsic implementation is still pending...
JuaniRios
changed the title
Draft: Feature/plmc 214 finalize evaluations
Feature/plmc 214 finalize evaluations
Jul 13, 2023
lrazovic
requested changes
Jul 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From an offline review:
- Calculating the total bonded in evaluations every time you evaluate is inefficient. We should store the total bonded somewhere and add to this on every evaluation.
- Use
StorageNMap
instead of having aBoundedVec
for all the evaluations/bids/contributions for a single project/user pair. - Use
PerQuintill
instead ofPerbill
.Perbill
only has 9 zeroes, and our Balance type uses 10, so we have precision problems right now, which we circumvent in tests with the new macroassert_close_enough
- We are not explicitly testing failed bid currency refunds
- Test bids with original price higher than weighed average are returned the difference on the community funding
new_with
method. - Failed bid return is implemented on
BadMath
rejection, and it needs to be implemented as well in after candle end - Write down test for CT sold out on remainder round. Right now it will fail because of the ensure in
do_funding_end
- Write test for PLMC unbonding on success and fail evaluation rounds
- Extract success or fail funding logic in
do_end_funding
into a function to call by the issuer in case of needing a manual acceptance (certain funding thresholds)
…plemented and tested
…ndingProject but it is already implemented if the caller adds it in teh BidInfoFilter
|
let mut consumed_weight = T::WeightInfo::insert_cleaned_project(); | ||
while !consumed_weight.any_gt(max_weight_per_project) { | ||
if let Ok(weight) = project_finalizer.do_one_operation::<T>(project_id) { | ||
consumed_weight += weight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
consumed_weight += weight | |
consumed_weight.saturating_accrue(weight); |
lrazovic
approved these changes
Jul 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Implement automatic rewards for evaluations based on the knowledge hub logic.
Changes Overview
We now have a state machine that handles the "cleaning" of a finished project. We call it a "finalizer"
Bids over the final weighted average price are counted down to the average price
Unbonding an evaluation is done in a single extrinsic, irrespective of if the funding was a success or not.
We can now represent a failed or successful funding for the project, and handle it with the new state machine.
Issues